package com.wondersgroup.fjzlpt.org.controller.rest.tdgl;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.quick.framework.util.QuickPrincipalUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.quick.framework.boot.web.utils.RequestUtils;
import com.wondersgroup.fjzlpt.org.service.inter.tdgl.TdglService;

@RestController
@RequestMapping("tdgl")
public class TdglRestController {

	@Autowired
	private TdglService tdglService;
	
	@RequestMapping("/queryPage")
	public JSONObject queryPage(HttpServletRequest request) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		map.put("WSJGLBDM", (String)QuickPrincipalUtils.getUserinfoByKey(request,"WSJGLBDM"));
		map.put("XZQHDM", (String)QuickPrincipalUtils.getUserinfoByKey(request,"JGXZQHDM"));
		return tdglService.queryPage(map);
	}
	
	@RequestMapping("save")
	public JSONObject save(HttpServletRequest request){
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return tdglService.save(map);
	}
	
	/**
	 * 提交审核
	 * @param request
	 * @param response
	 */
	@RequestMapping("submitCheck")
	public JSONObject submitCheck(HttpServletRequest request,HttpServletResponse response) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return tdglService.submitCheck(map);
	}
	
	@RequestMapping("delete")
	public JSONObject delete(HttpServletRequest request) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return tdglService.delete(map);
	}
	
	@RequestMapping("queryYljgryxxWithConditionByPage")
	public JSONObject queryYljgryxxWithConditionByPage(HttpServletRequest request) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return tdglService.queryYljgryxxWithConditionByPage(map);
	}
	
	/**
	 * 根据名称模糊查询机构信息-分页查询
	 * @param request
	 * @return
	 */
	@RequestMapping("queryYljgxxByPage")
	public JSONObject queryYljgxxByPage(HttpServletRequest request) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return tdglService.queryYljgxxByPage(map);
	}
	
	@RequestMapping("queryTdcylbAll")
	public JSONArray queryTdcylbAll(HttpServletRequest request) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return tdglService.queryTdcylbAll(map);
	}
	
	@RequestMapping("queryTdshxx")
	public JSONObject queryTdshxx(HttpServletRequest request) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return tdglService.queryTdshxx(map);
	}
	
	@RequestMapping("queryLogsByPage")
	public JSONObject queryLogsByPage(HttpServletRequest request) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return tdglService.queryLogsByPage(map);
	}
	
	@RequestMapping("checkTdxx")
	public JSONObject checkTdxx(HttpServletRequest request) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return tdglService.checkTdxx(map);
	}
	
	/**
	 * 根据用户id查询医疗机构人员信息
	 * @param request
	 * @return
	 */
	@RequestMapping("queryYljgryxxByUserid")
	public JSONObject queryYljgryxxByUserid(HttpServletRequest request) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return tdglService.queryYljgryxxByUserid(map);
	}
	
	/**
	 * 查询医疗机构人员多点执业信息
	 * @param request
	 * @return
	 */
	@RequestMapping("queryYljgryDdzy")
	public JSONObject queryYljgryDdzy(HttpServletRequest request) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		return tdglService.queryYljgryDdzy(map);
	}
	
	@RequestMapping("downTdxxToExcel")
	public void downTdxxToExcel(HttpServletRequest request,HttpServletResponse response) {
		Map<String, String> map = RequestUtils.GetParameterMap(request);
		tdglService.downTdxxToExcel(map,request,response);
	}
	
}
